Microsoft Foundation Classes (mfc.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
CMapStringToOb::operator []
CMapStringToOb                              Up Contents Index Back
──Microsoft Foundation Classes──────────────────────────────────────────────
 
  CObject*& operator []( const char* key );
 
  Remarks
 
  This operator is a convenient substitute for the SetAt member function.
  Thus it can be used only on the left side of an assignment statement (an
  l-value). If there is no map element with the specified key, then a new
  element is created.
 
  There is no "right side" (r-value) equivalent to this operator because
  there is a possibility that a key may not be found in the map. Use the
  Lookup member function for element retrieval.
 
  Example
 
  CMapStringToOb map;
 
  map["Bart"] = new CAge( 13 );
  map["Lisa"] = new CAge( 11 );
 
  The results from this program are as follows:
 
  Operator [] example: A CMapStringToOb with 2 elements
      [Lisa] = a CAge at $4A02 11
      [Bart] = a CAge at $497E 13
 
  See Also
 
  CMapStringToOb::SetAt, CMapStringToOb::Lookup
 
 
                                     -♦-